package com.ht.medicaltreatment.activity.haocai2

import androidx.activity.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.gym.baselib.base.BaseActivity
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.activity.haocai2.viewmodel.ConsumableDetailViewModel
import com.ht.medicaltreatment.adapter.ConsumableDetailAdapter
import kotlinx.android.synthetic.main.activity_consumable_detail_layout.recyclerView

//耗材明细
class ConsumableDetailActivity:BaseActivity() {
    override fun getLayoutId() = R.layout.activity_consumable_detail_layout

    private val model by viewModels<ConsumableDetailViewModel>()

    override fun init() {
        setTitle("耗材明细")
        val sign = intent.getIntExtra("sign",0)
        val id = intent.getIntExtra("id",0)

        recyclerView.layoutManager = LinearLayoutManager(this)
        val adapter = ConsumableDetailAdapter()
        recyclerView.adapter = adapter
        showProgress()
        model.detail("$id","$sign"){
            adapter.setNewInstance(it)
            dismissProgress()
        }
    }
}